package done.easy_001_100;

import lombok.extern.slf4j.Slf4j;
import org.junit.Test;

import static com.study.util.LogUtil.info;
import static org.junit.Assert.assertTrue;

/**
 * 38 Count and Say 报数
 * The count-and-say sequence is the sequence of integers beginning as follows:
 * 1, 11, 21, 1211, 111221, ...
 * <p>
 * 1 is read off as "one 1" or 11.
 * 11 is read off as "two 1s" or 21.
 * 21 is read off as "one 2, then one 1" or 1211.
 *
 * @author 大硕
 * 2019-03-20 11:52 PM
 **/
@Slf4j
public class CountAndSay {

    @SuppressWarnings("all")
    public String countAndSay(int n) {
        //190321 first
        String res = "";
        return res;
    }

    @Test
    public void test() {
        info("13112221 -> {}", countAndSay(7));
    }

}




















/*
String countAndSay(int n) {
    if(n==1) return "1";

    String s = countAndSay(n-1);//  递归

    String m = "";
    int k;//  记录“连续”相同的个数
    char c;//  记录当前值
    for (int i = 0; i < s.length(); i+=k) {
        c = s.charAt(i);
        k = 0;
        for (int j = i; j < s.length(); j++) {
            if (c==s.charAt(j)) {
                k++;
            } else {
                break;//  不要忘，漏掉将累加进不连续相同的值
            }
        }
        if (k!=0) {
            m += k;
            m += c;
        }
    }
    return m;//  返回类型String
}
*/